<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
      .container {
          width: 100%;
          height: 1000px;
          box-sizing: border-box;
          border: 3px solid #aaa;
      }
      .nav {
          width: 100%;
          height: 50px;
          border-bottom: 3px solid #aaa;
          display: flex;
      }

      .nav-item {
          height: 50px;
          flex: 1;
          text-align: center;
          line-height: 50px;
      }

      .nav-item:hover,
      .active {
          background-color: red;
          cursor: pointer;
      }

    </style>
</head>
<body>

    <div class="container">
        <div class="nav">
            <!-- <div class="nav-item">a</div>
            <div class="nav-item">b</div>
            <div class="nav-item">c</div> -->
        </div>
        <div class="content">aaaaa</div>
    </div>

    <script src="./jq.js"></script>

    <script>

        const data = [
            {
                content: 'aaaaaaaaa',
                title: 'a',
            },
            {
                content: 'bbbbbbbb',
                title: 'b',
            },
            {
                content: 'ccccccccc',
                title: 'c',
            },
            {
                content: 'ddddddddd',
                title: 'd',
            },
        ];

        for (const item of data) {
            const el = $(`<div class="nav-item">${ item.title }</div>`);
            $('.nav').append(el);
        }

        $('.nav-item').on('click', function () {
            $(this)
                .addClass('active')
                .siblings('.nav-item')
                .removeClass('active');

            const index = $(this).index();
            $('.content').text(data[index].content);
        });

    </script>
</body>
</html>